package cn.funnyxb.powerremember.db.tables;

import android.database.Cursor;
import cn.funnyxb.powerremember.beans.AWord;
import cn.funnyxb.tools.appFrame.database.DBHolder;
import cn.funnyxb.tools.appFrame.database.DBService;
import cn.funnyxb.tools.appFrame.database.TableHolder;
import cn.funnyxb.tools.appFrame.debugTool.Debuger;
import java.util.HashMap;

public class Tbholder_taskWithWords extends TableHolder
{
  private static HashMap<String, Tbholder_taskWithWords> allholders = new HashMap();

  public Tbholder_taskWithWords(DBHolder paramDBHolder, String paramString)
  {
    super(paramDBHolder, "task_" + paramString);
  }

  private String getTbCreateSQL_task()
  {
    return "CREATE TABLE [" + this.tableName + "] (" + "[" + "_id" + "] integer primary key autoincrement" + ",[" + "word" + "] text NOT NULL ON CONFLICT FAIL" + ",[" + "pronounce" + "] text NOT NULL ON CONFLICT FAIL" + ",[" + "meaning" + "] text NOT NULL ON CONFLICT FAIL" + ",[" + "difficulty" + "] integer default 1 " + ",[" + "starnum" + "] " + ",[" + "laststudytime" + "] integer " + ",[" + "wrongtimes" + "] integer  default 0" + ",[" + "righttimes" + "] integer  default 0" + ")";
  }

  private void log(String paramString)
  {
    Debuger.log("tbh_taskwithwords", paramString);
  }

  public static void removeTbholderFromList(String paramString)
  {
    allholders.remove(paramString);
  }

  public void copyFromWordBase(String paramString)
  {
    String str = "insert into " + this.tableName + "(" + "word" + "," + "pronounce" + "," + "meaning" + " ) select " + "word" + "," + "pronounce" + "," + "meaning" + " from " + paramString;
    log("copy,sql=" + str);
    this.dbHolder.getDbService().execSql(str);
  }

  public void createTaskWordsTb()
  {
    this.dbHolder.getDbService().execSql("drop table if exists " + this.tableName);
    this.dbHolder.getDbService().execSql(getTbCreateSQL_task());
  }

  public Cursor queryAPart(int paramInt1, int paramInt2, int paramInt3, int paramInt4, String paramString)
  {
    String str1 = "select *  from " + this.tableName + " where " + "_id" + " between ? and  ? ";
    if ((paramString != null) && (paramString.trim().length() > 0))
      str1 = str1 + " and  " + paramString;
    String str2 = str1 + " limit ?,? ";
    log("query apart,sql=" + str2);
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[4];
    arrayOfString[0] = paramInt1;
    arrayOfString[1] = paramInt2;
    arrayOfString[2] = paramInt3;
    arrayOfString[3] = paramInt4;
    return localDBService.query(str2, arrayOfString);
  }

  public int queryAPartCnt(int paramInt1, int paramInt2, String paramString)
  {
    String str = "select count(*)  from " + this.tableName + " where " + "_id" + " between ? and ?  ";
    if ((paramString != null) && (paramString.trim().length() > 0))
      str = str + " and " + paramString;
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[2];
    arrayOfString[0] = paramInt1;
    arrayOfString[1] = paramInt2;
    Cursor localCursor = localDBService.query(str, arrayOfString);
    if (localCursor == null);
    int i;
    for (int j = 0; ; j = i)
    {
      while (true)
      {
        return j;
        if (localCursor.getCount() != 0)
          break;
        localCursor.close();
        j = 0;
      }
      localCursor.moveToFirst();
      i = localCursor.getInt(0);
      localCursor.close();
    }
  }

  public AWord queryAWord(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, String paramString)
  {
    log("queryAword, isbefore=" + paramBoolean + ",rangestartid=" + paramInt1 + ",rangeend=" + paramInt2 + ",start=" + paramInt3 + ",sqlfilter=" + paramString);
    String str1 = "select *  from " + this.tableName + " where " + "_id" + " between ? and ? ";
    if ((paramString != null) && (paramString.trim().length() > 0))
      str1 = str1 + " and " + paramString;
    if (paramBoolean)
      str1 = str1 + " order by _id desc ";
    String str2 = str1 + " limit 0 ,1";
    log("queryAword,sql=" + str2);
    log("rangeStartid=" + paramInt1 + ",wordStartId=" + paramInt3 + ",wordRangeEndId=" + paramInt2);
    int i;
    label260: String[] arrayOfString;
    int k;
    label306: label320: Cursor localCursor;
    if ((paramInt3 >= paramInt1) && (paramInt3 <= paramInt2))
    {
      i = 1;
      if (!(paramBoolean))
        break label359;
      arrayOfString = new String[2];
      arrayOfString[0] = paramInt1;
      StringBuilder localStringBuilder2 = new StringBuilder();
      if (i == 0)
        break label353;
      k = paramInt3;
      arrayOfString[1] = k;
      localCursor = this.dbHolder.getDbService().query(str2, arrayOfString);
      if (localCursor != null)
        break label424;
    }
    label353: label359: AWord localAWord;
    for (Object localObject = null; ; localObject = localAWord)
    {
      while (true)
      {
        return localObject;
        i = 0;
        break label260:
        k = paramInt2;
        break label306:
        arrayOfString = new String[2];
        StringBuilder localStringBuilder1 = new StringBuilder();
        if (i != 0);
        for (int j = paramInt3; ; j = paramInt1)
        {
          arrayOfString[0] = j;
          arrayOfString[1] = paramInt2;
          break label320:
        }
        label424: if (localCursor.getCount() != 0)
          break;
        localCursor.close();
        localObject = null;
      }
      localCursor.moveToFirst();
      localAWord = AWord.parseFromCursor(localCursor);
      localCursor.close();
    }
  }

  public AWord queryAWordById(int paramInt)
  {
    String str = "select *  from " + this.tableName + " where " + "_id" + " = ?";
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[1];
    arrayOfString[0] = paramInt;
    Cursor localCursor = localDBService.query(str, arrayOfString);
    if (localCursor == null);
    AWord localAWord;
    for (Object localObject = null; ; localObject = localAWord)
    {
      while (true)
      {
        return localObject;
        if (localCursor.getCount() != 0)
          break;
        localCursor.close();
        localObject = null;
      }
      localCursor.moveToFirst();
      localAWord = AWord.parseFromCursor(localCursor);
      localCursor.close();
    }
  }

  public int queryCntInRange(int paramInt1, int paramInt2, String paramString)
  {
    String str = new StringBuilder("select count(*)  from ").append(this.tableName).toString() + " where _id between " + paramInt1 + " and " + paramInt2;
    if ((paramString != null) && (paramString.trim().length() > 0))
      str = str + " and " + paramString;
    Cursor localCursor = this.dbHolder.getDbService().query(str, null);
    if ((localCursor == null) || (localCursor.getColumnCount() == 0))
      localCursor.close();
    int j;
    for (int i = 0; ; i = j)
    {
      return i;
      localCursor.moveToFirst();
      j = localCursor.getInt(0);
      localCursor.close();
    }
  }

  public void updateDifficulty(int paramInt1, int paramInt2)
  {
    String str = "update " + this.tableName + " set " + "difficulty" + " = ? where " + "_id" + "= ?";
    DBService localDBService = this.dbHolder.getDbService();
    Object[] arrayOfObject = new Object[2];
    arrayOfObject[0] = Integer.valueOf(paramInt2);
    arrayOfObject[1] = Integer.valueOf(paramInt1);
    localDBService.execSql(str, arrayOfObject);
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.powerremember.db.tables.Tbholder_taskWithWords
 * JD-Core Version:    0.5.3
 */